package year2021.month08910;

public class ThreadTest {

    public static void main(String[] args) throws InterruptedException {
        ThreadTest test = new ThreadTest();

        Thread t1 = new Thread(new MyThread(test));
        t1.start();
//        t1.join();
//        t1.wait();

        System.out.println("End!!!");
    }


}

class MyThread implements Runnable{

    Object thatObj;

    public MyThread(Object thatObj){
        this.thatObj = thatObj;
    }

    @Override
    public void run() {
        System.out.println("My start ...");
        try {
            synchronized (this){
                this.wait();
                Thread.sleep(1000L);
                this.notify();
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("My end.");
    }

}